<?php

/**
 * Description of VirtualLabs_Rest_Network_Firewall
 *
 * @author markos
 */
class VirtualLabs_Rest_Network_Firewall {
    const DEFAULT_PORT_FWD_PROTO = "TCP";

    /**
     * 
     * 
     * @param type $ipAddressId
     * @param type $privatePort
     * @param type $publicPort
     * @param type $virtualMachineId
     * @param type $networkId
     * @return type
     */
    public function createPortForwarding($ipAddressId, $privatePort, $publicPort, $virtualMachineId, $networkId) {
        $url = array();
        $url["response"] = "json";
        $url["command"] = "createPortForwardingRule";
        $url["ipaddressid"] = $ipAddressId;
        $url["privateport"] = $privatePort;
        $url["protocol"] = self::DEFAULT_PORT_FWD_PROTO;
        $url["publicport"] = $publicPort;
        $url["virtualmachineid"] = $virtualMachineId;
        $url["networkid"] = $networkId;

        $v = new VirtualLabs_Rest_HttpClient_Client();
        $response = $v->call($url);

        $createPortForwardingRuleResponse = Zend_Json_Decoder::decode($response);
        return $createPortForwardingRuleResponse;
    }

}

?>
